home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc B) / Acorn User China CD-ROM (UK) (Disc B).bin / STUTTGART / FROMUTS / MAKEPCX / source_h_makepcx < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-08  |  2.2 KB  |  67 lines

  1. /*******************************************************************************
  2.  
  3. $Header$
  4.  
  5. Header file for Sprite to PCX conversion utilities
  6.  
  7. $Log$
  8.  
  9. *******************************************************************************/
  10.  
  11. #define PCX_TYPE 0x697                 /* PCX filetype as used by !Transltr */
  12.  
  13. extern int default_pal_type;         /* 0 = BBC, 1 = Desktop, 2 = file         */
  14. extern  int force_pal;                /* Apply default palette to all sprites */
  15.  
  16. /* Macro short hand for casting sprite pointer to header struct */
  17.  
  18. #define sp_h(x)    ( *((sprite_header *) (x)) )
  19.  
  20. #define FINFO_ERR    -1
  21. #define FINFO_DIR    0x1002
  22. #define FINFO_DATA  0x1001
  23.  
  24. typedef unsigned char ubyte;
  25. typedef unsigned short uword; 
  26.  
  27. /* PCX Header block */
  28.  
  29. typedef struct {
  30.     ubyte     code;                    /* 10                         */
  31.     ubyte     version;                /* 5 = V3 here                 */
  32.     ubyte     encoding;                /* Always 1 - RLE             */
  33.     ubyte    bits;                    /* Bits per pixel             */        
  34.     uword    minx, miny, maxx, maxy; /* Image area                 */
  35.     uword    hres;                    /* H resloution             */
  36.     uword    vres;                    /* V resolution             */
  37.     ubyte    palette[48];            /* Palette data    (16 colour)    */
  38.     ubyte    reserved;                /* Set to 0                 */
  39.     ubyte    planes;                    /* Colour planes - 1 or 4     */
  40.     uword    line_length;            /* Bytes-per-line           */
  41.     uword    palinfo;                /* Always set to 1            */
  42.     ubyte    pad[58];                /* Pad out to 128 bytes     */
  43. } pcx_hdr_t ;
  44.  
  45. /*******************************************************************************
  46.  
  47.     Function Prototypes
  48.  
  49. *******************************************************************************/
  50.  
  51. int finfo ( char * name, int * len );
  52. int settype ( char * file, int type );
  53. void do_os_error(os_error * oserr);
  54. void do_c_error( int c_err );
  55. void do_error ( char * string, int param );
  56. ubyte * choose_palette ( int bpp );
  57. void pre_process_sprite ( sprite_area * sp_area_p, sprite_ptr sp_p,
  58.     sprite_id * sp_id_p,
  59.     int * bpp, int * words,
  60.     int * w, int * h, ubyte palette[] );
  61. int encode_pcx ( ubyte * out_buffer, int * line_p, int width, int bpp );
  62. int make_pcx ( sprite_area * sp_area_p, sprite_ptr sp_p, FILE * pcxout );
  63. int strisnum ( char * s );
  64. int mkdir ( char * dir );
  65. sprite_ptr sprite_find ( sprite_area * sp_area_p, int number, char * name, int * new_n_p );
  66. int get_bpp_and_pal ( sprite_area * sp_area_p, sprite_ptr sp_p );
  67.